﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using eBookDirectory.Common.Dtos;
using eBookDirectory.Infrastructure.Repository;
using eBookDirectory.Service.Services;
using eBookDirectory.ServiceTest.Infrastructure;

namespace eBookDirectory.ServiceTest
{
    [TestClass]
    public class BookServiceTest
    {
        [TestMethod,TestCategory(Category.Repository)]
        public void CreateCustomer()
        {
            // need to create an instance of the repository
            var service = new BookService();
            service.Repository = new RepositoryLocatorEntityStore();
            var dto = new BookDto
            {
                Name = "John",
                Description= "Doe"
            };

            var book = service.CreateNewCustomer(dto);
            Assert.IsFalse(book.Id == 0, "Book Id should have been updated");
            Assert.AreSame(book.Name, dto.Name, "Name are different");
        }
    }
}
